import javax.swing.JDialog;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EmptyBorder;
import javax.swing.SwingConstants;
import javax.swing.JTextArea;

public class UnoHowToPlay_UI extends JDialog
{
	private static final long serialVersionUID = 6416509906021416480L;
	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch UnoAbout_UI
	 */
	public static void launch()
	{
		try
		{
			UnoHowToPlay_UI dialog = new UnoHowToPlay_UI();

			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e)
		{
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public UnoHowToPlay_UI()
	{
		String message = "The deck has 108 cards consisting of four suits, wild cards, and word "
				+ "cards with directions on them.  Each player is delt seven cards. Turn "
				+ "the top card of the draw pile over to form the discard pile.  Take turns "
				+ "beginning with the player to the dealer's left and go clockwise around the "
				+ "table.  To play a card simply click on the card you wish to play. Your "
				+ "card must have the same number, color or wording as the top card of the "
				+ "discard pile - or be a wild card.  Draw a card if you cannot discard. "
				+ "Play the drawn card if you can. If you can't, it's the next person's turn.  "
				+ "Select a suit when you place a wild card on the discard pile. You can play "
				+ "a wild card any time it's your turn and can name any suit you wish.  Announce "
				+ "a suit when you place a Draw Four card on the discard pile.  Follow the "
				+ "directions of a nword card that is played on the discard pile by the player "
				+ "preceding you. This may meanthat you have to draw two cards, skip a turn or "
				+ "even draw four cards.  Say \"UNO\" when you have one card left in your "
				+ "hand. If you forget to say UNO and another player catches you, you must draw "
				+ "two cards.  Tally all the points when one player is out of cards.";
		
		Uno_UI.setAttributesDialog(this, "How to Play");
		Uno_UI.setUIManager();

		getContentPane().setLayout(new BorderLayout());
		contentPanel.setForeground(Uno_UI.WHITE);
		contentPanel.setBackground(Uno_UI.BLACK);
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(null);
		
		JLabel lblAbout = new JLabel("Unonymous - Uno | How to Play");
		lblAbout.setForeground(Uno_UI.WHITE);
		lblAbout.setBackground(Uno_UI.BLACK);
		lblAbout.setFont(Uno_UI.CONSOLAS14);
		lblAbout.setVerticalAlignment(SwingConstants.TOP);
		lblAbout.setBounds(20, 11, 404, 14);
		contentPanel.add(lblAbout);
		
		JTextArea textArea = new JTextArea(message);
		textArea.setEditable(false);
		textArea.setLineWrap(true);
		textArea.setWrapStyleWord(true);
		textArea.setForeground(Uno_UI.WHITE);
		textArea.setBackground(Uno_UI.BLACK);
		textArea.setFont(Uno_UI.CONSOLAS14);
		textArea.setBounds(10, 36, 414, 215);
		
		JScrollPane scrollPane = new JScrollPane(textArea);
		scrollPane.setLocation(20, 36);
		scrollPane.setSize(404, 215);
		scrollPane.setPreferredSize(new Dimension(414, 215));
		contentPanel.add(scrollPane);
	}
}
